@echo off
chcp 65001
CLS
color 0a


if not exist .\output ( md .\output )

set ToolsFolder="%CD%"
set ServerFolder="../server"



GOTO MENU
:MENU
ECHO.
ECHO.=-=-=-=-==-=-=-=-=华丽的分割线=-=-=-=-==-=-=-=-=
ECHO.
ECHO.     1  单机版导表
ECHO.
ECHO.     2  服务器导表
ECHO.
ECHO.     3  服务器编译(win)
ECHO.
ECHO.     4  服务器编译(linux)
ECHO.
ECHO.     9  退 出
ECHO.
ECHO.
ECHO.当前Tools路径:%ToolsFolder%
echo.请输入选择项目的序号:
set /p  ID=
if "%id%"=="1" ( goto cmdArt)
if "%id%"=="2"  ( goto cmdDesigner)
if "%id%"=="3"  ( goto cmdBuildWin)
if "%id%"=="4"  ( goto cmdBuildLinux)
if "%id%"=="8"  ( goto cmdExcelPath)
if "%id%"=="9" ( exit ) else ( GOTO MENU )
PAUSE



:cmdArt
echo 策划们导表
cd tools
.\bin\xlsx --config="xlsx_output.toml"
cd %ToolsFolder%
goto MENU


:cmdDesigner
echo 服务器导表
cd tools
.\bin\xlsx --config="xlsx_output.toml" --go="../%ServerFolder%/share/protoc"
cd %ToolsFolder%
goto MENU


:cmdBuildWin

set CURRENT_DATE_TIME=%date:~3,4%-%date:~8,2%-%date:~11,2% %time:~0,2%:%time:~3,2%:%time:~6,2%
echo 开始编译windows包,当前时间:%CURRENT_DATE_TIME%
cd %ServerFolder%
SET CGO_ENABLED=0
SET GOOS=windows
SET GOARCH=amd64
go build -o %ToolsFolder%/output/bin/locator.exe  -ldflags "-X 'github.com/hwcer/cosgo.Version=%CURRENT_DATE_TIME%'"  ./locator.go
go build -o %ToolsFolder%/output/bin/server.exe -ldflags "-X 'github.com/hwcer/cosgo.Version=%CURRENT_DATE_TIME%'" ./server.go
cd %ToolsFolder%
echo 编译完成请手动提交

goto MENU



:cmdBuildLinux
set CURRENT_DATE_TIME=%date:~3,4%-%date:~8,2%-%date:~11,2% %time:~0,2%:%time:~3,2%:%time:~6,2%
echo 开始编译linux包,当前时间:%CURRENT_DATE_TIME%
cd %ServerFolder%
SET CGO_ENABLED=0
SET GOOS=linux
SET GOARCH=amd64
go build -o %ToolsFolder%/output/bin/locator  -ldflags "-X 'github.com/hwcer/cosgo.Version=%CURRENT_DATE_TIME%'"  ./locator.go
go build -o %ToolsFolder%/output/bin/server  -ldflags "-X 'github.com/hwcer/cosgo.Version=%CURRENT_DATE_TIME%'"  ./server.go
cd %ToolsFolder%
echo 编译完成请手动提交

goto MENU


